package stone.ast;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import runner.Environment;
import stone.Token;

public class Name extends ASTLeaf {
  public Name(Token t) {
    super(t);
  }

  public String name() {
    return getToken().getText();
  }

  @NotNull
  @Override
  public Object eval(@Nullable Environment env) {
    assert env != null;
    return env.get(name());
  }
}
